namespace yiCommerce.Data.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class add_alipaysetting : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.AlipayPaymethodSetting",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        AlipaySellerEmail = c.String(),
                        AlipayKey = c.String(),
                        AlipayPartner = c.String(),
                        ShopId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Shop", t => t.ShopId, cascadeDelete: true)
                .Index(t => t.ShopId);
            
            AddColumn("dbo.Shop", "AlipayPaymethodSetting_Id", c => c.Int());
            AddForeignKey("dbo.Shop", "AlipayPaymethodSetting_Id", "dbo.AlipayPaymethodSetting", "Id");
            CreateIndex("dbo.Shop", "AlipayPaymethodSetting_Id");
            DropColumn("dbo.Shop", "AlipaySellerEmail");
            DropColumn("dbo.Shop", "AlipayKey");
            DropColumn("dbo.Shop", "AlipayPartner");
        }
        
        public override void Down()
        {
            AddColumn("dbo.Shop", "AlipayPartner", c => c.String());
            AddColumn("dbo.Shop", "AlipayKey", c => c.String());
            AddColumn("dbo.Shop", "AlipaySellerEmail", c => c.String());
            DropIndex("dbo.AlipayPaymethodSetting", new[] { "ShopId" });
            DropIndex("dbo.Shop", new[] { "AlipayPaymethodSetting_Id" });
            DropForeignKey("dbo.AlipayPaymethodSetting", "ShopId", "dbo.Shop");
            DropForeignKey("dbo.Shop", "AlipayPaymethodSetting_Id", "dbo.AlipayPaymethodSetting");
            DropColumn("dbo.Shop", "AlipayPaymethodSetting_Id");
            DropTable("dbo.AlipayPaymethodSetting");
        }
    }
}
